package cn.mjnxin.iot.connector.base;

import cn.mjnxin.iot.base.domain.ChannelData;
import cn.mjnxin.iot.connector.context.IPeerContext;
import cn.mjnxin.iot.connector.worker.Connector2GateWorker;

/**
 * 异步放置ChannelData
 * @author CLG 2023年10月10日
 * @version V1.0.0
 */
public class ChannelDataSender implements IChannelDataSender{
	private final Connector2GateWorker instance = Connector2GateWorker.getInstance();
	
	private final IPeerContext userContext;
	
	private final String gateAddress;
	
	public ChannelDataSender(IPeerContext userContext, String gateAddress) {
		this.userContext = userContext;
		this.gateAddress = gateAddress;
	}

	@Override
    public void sendChannelData(ChannelData request) {
		instance.add(request);
    }

	@Override
	public IPeerContext peerContext() {
		return userContext;
	}

	@Override
	public String getGateAddress() {
		return gateAddress;
	}
}
